package org.eae.eldf.framework.service;

import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eae.eldf.framework.dao.JdbcDao;
import org.eae.eldf.framework.persistence.Criteria;
import org.springframework.stereotype.Component;
/**
 * 
 * @author xuanming.feng
 *
 * @param <T>
 */
@Component("baseService")
public class BaseServiceImpl<T> implements BaseService<T> {
	protected final Logger log = LogManager.getLogger(getClass());
	
	protected JdbcDao dao = null;
	
	

	@Override
	public Long insert(Object entity) {
		return dao.insert(entity);
	}

	@Override
	public Long insert(Criteria criteria) {
		return dao.insert(criteria);
	}

	@Override
	public void save(Object entity) {
		// TODO Auto-generated method stub
		dao.save(entity);
	}

	@Override
	public void save(Criteria criteria) {
		// TODO Auto-generated method stub
		dao.save(criteria);
	}

	@Override
	public void update(Criteria criteria) {
		// TODO Auto-generated method stub
		dao.update(criteria);
	}

	@Override
	public void update(Object entity) {
		// TODO Auto-generated method stub
		dao.update(entity);
	}

	@Override
	public void delete(Criteria criteria) {
		// TODO Auto-generated method stub
		dao.delete(criteria);
	}

	@Override
	public void delete(Object entity) {
		// TODO Auto-generated method stub
		dao.delete(entity);
	}

	@Override
	public void delete(Class<?> clazz, Long id) {
		// TODO Auto-generated method stub
		dao.delete(clazz, id);
	}

	@Override
	public void deleteAll(Class<?> clazz) {
		// TODO Auto-generated method stub
		dao.deleteAll(clazz);
	}

	@Override
	public <T> List<T> queryList(Criteria criteria) {
		// TODO Auto-generated method stub
		return dao.queryList(criteria);
	}

	@Override
	public <T> List<T> queryList(T entity) {
		// TODO Auto-generated method stub
		return dao.queryList(entity);
	}

	@Override
	public <T> List<T> queryList(T entity, Criteria criteria) {
		// TODO Auto-generated method stub
		return dao.queryList(entity, criteria);
	}

	@Override
	public int queryCount(Object entity) {
		// TODO Auto-generated method stub
		return dao.queryCount(entity);
	}

	@Override
	public int queryCount(Criteria criteria) {
		// TODO Auto-generated method stub
		return dao.queryCount(criteria);
	}

	@Override
	public int queryCount(Object entity, Criteria criteria) {
		// TODO Auto-generated method stub
		return dao.queryCount(entity, criteria);
	}

	@Override
	public <T> T get(Class<T> clazz, Long id) {
		// TODO Auto-generated method stub
		return dao.get(clazz, id);
	}

	@Override
	public <T> T get(Criteria criteria, Long id) {
		// TODO Auto-generated method stub
		return dao.get(criteria, id);
	}

	@Override
	public <T> T querySingleResult(T entity) {
		// TODO Auto-generated method stub
		return dao.querySingleResult(entity);
	}

	@Override
	public <T> T querySingleResult(Criteria criteria) {
		// TODO Auto-generated method stub
		return dao.querySingleResult(criteria);
	}

	@Override
	public byte[] getBlobValue(Class<?> clazz, String fieldName, Long id) {
		// TODO Auto-generated method stub
		return dao.getBlobValue(clazz, fieldName, id);
	}
}
